package com.wisezone.HomeWork.home0218;

import com.wisezone.demo0217.Person;

import java.lang.reflect.Method;

public class Test1 {
    public void test1()throws Exception{
        Class clazz = Person.class;
        //1.getMethods()获取运行时类及其父类声明的所有的public修饰的方法
        Method []method = clazz.getMethods();
        for (Method method2 :method){
            System.out.println(method2);
        }
        System.out.println("------------------------------");
        //2.getDeclaredMethods()获取运行时类本身声明的所有的方法
        method = clazz.getDeclaredMethods();
        for (Method method2 : method){
            System.out.println(method2);
        }
    }
}
